package com.x.wx.mp.controller;

import java.io.File;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;

import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfAccountRequest;
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfList;
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfMsgList;
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfOnlineList;
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionGetResult;
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionList;
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionWaitCaseList;

/**
 * <pre>
 *  注意：此contorller 实现WxMpKefuService接口，仅是为了演示如何调用所有群发消息相关操作接口，
 *      实际项目中无需这样，根据自己需要添加对应接口即可
 * </pre>
 *
 * @author Binary Wang(https://github.com/binarywang)
 */
@RestController
@RequestMapping("/wechat/kefu")
public class WxMpKefuController {

	@Autowired
	private WxMpService wxService;

	
	@PostMapping(value = "/sendKefuMessage")
	public boolean sendKefuMessage(String req) throws WxErrorException {
		WxMpKefuMessage message = JSON.parseObject(req, WxMpKefuMessage.class);
		return this.wxService.getKefuService().sendKefuMessage(message);
	}

	
	public WxMpKfList kfList() throws WxErrorException {
		// TODO Auto-generated method stub
		return null;
	}

	
	public WxMpKfOnlineList kfOnlineList() throws WxErrorException {
		// TODO Auto-generated method stub
		return null;
	}

	
	public boolean kfAccountAdd(WxMpKfAccountRequest request) throws WxErrorException {
		// TODO Auto-generated method stub
		return false;
	}

	
	public boolean kfAccountUpdate(WxMpKfAccountRequest request) throws WxErrorException {
		// TODO Auto-generated method stub
		return false;
	}

	
	public boolean kfAccountInviteWorker(WxMpKfAccountRequest request) throws WxErrorException {
		// TODO Auto-generated method stub
		return false;
	}

	
	public boolean kfAccountUploadHeadImg(String kfAccount, File imgFile) throws WxErrorException {
		// TODO Auto-generated method stub
		return false;
	}

	
	public boolean kfAccountDel(String kfAccount) throws WxErrorException {
		// TODO Auto-generated method stub
		return false;
	}

	
	public boolean kfSessionCreate(String openid, String kfAccount) throws WxErrorException {
		// TODO Auto-generated method stub
		return false;
	}

	
	public boolean kfSessionClose(String openid, String kfAccount) throws WxErrorException {
		// TODO Auto-generated method stub
		return false;
	}

	
	public WxMpKfSessionGetResult kfSessionGet(String openid) throws WxErrorException {
		// TODO Auto-generated method stub
		return null;
	}

	
	public WxMpKfSessionList kfSessionList(String kfAccount) throws WxErrorException {
		// TODO Auto-generated method stub
		return null;
	}

	
	public WxMpKfSessionWaitCaseList kfSessionGetWaitCase() throws WxErrorException {
		// TODO Auto-generated method stub
		return null;
	}

	
	public WxMpKfMsgList kfMsgList(Date startTime, Date endTime, Long msgId, Integer number) throws WxErrorException {
		// TODO Auto-generated method stub
		return null;
	}

	
	public WxMpKfMsgList kfMsgList(Date startTime, Date endTime) throws WxErrorException {
		// TODO Auto-generated method stub
		return null;
	}
}
